package com.base.api.order;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationRunnerOrderImpl implements ApplicationRunner{

    private final OrderAutoPoolExecutorService orderAutoPoolExecutorService;

    public ApplicationRunnerOrderImpl(OrderAutoPoolExecutorService orderAutoPoolExecutorService) {
        this.orderAutoPoolExecutorService = orderAutoPoolExecutorService;
    }

    @Override
    public void run(ApplicationArguments args) {
        orderAutoPoolExecutorService.start();
        Runtime.getRuntime().addShutdownHook(new Thread(orderAutoPoolExecutorService::shutdown));
    }


}
